package com.bdqn.service.impl;

import com.bdqn.dao.SysUserMapper;
import com.bdqn.pojo.SysUser;
import com.bdqn.service.SysUserService;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.List;

@Scope("prototype")
@Service
//@Service("sysUserService")
public class SysUserServiceImpl implements SysUserService {

    //@Autowired // @Resource
    private SysUserMapper sysUserMapper;

    @Override
    public List<SysUser> getList(SysUser sysUser) {
        try {
            return sysUserMapper.selectSysUserList(sysUser);
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
    }

    // @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public boolean add(SysUser sysUser) {
        sysUserMapper.add(sysUser);
        //int num = 5 / 0; // 模拟程序中抛出异常
        // if (sysUser != null) {
        // 手动抛出异常
        // throw new SendEMailException("发送通知邮件异常");
        // }
        sysUserMapper.add(sysUser);
        return true;
    }

}